home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / HIERSV.PAK / IPFRAME.CPP < prev    next >
C/C++ Source or Header  |  1997-05-06  |  4KB  |  128 lines

  1. // ipframe.cpp : implementation of the CInPlaceFrame class
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13.  
  14. #include "stdafx.h"
  15. #include "hiersvr.h"
  16. #include "ipframe.h"
  17.  
  18. #ifdef _DEBUG
  19. #undef THIS_FILE
  20. static char BASED_CODE THIS_FILE[] = __FILE__;
  21. #endif
  22.  
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CInPlaceFrame
  25.  
  26. IMPLEMENT_DYNCREATE(CInPlaceFrame, COleIPFrameWnd)
  27.  
  28. BEGIN_MESSAGE_MAP(CInPlaceFrame, COleIPFrameWnd)
  29.     //{{AFX_MSG_MAP(CInPlaceFrame)
  30.     ON_WM_CREATE()
  31.     ON_UPDATE_COMMAND_UI(ID_CONTEXT_HELP, OnUpdateContextHelp)
  32.     //}}AFX_MSG_MAP
  33.     // Global help commands
  34.     ON_COMMAND(ID_HELP_INDEX, COleIPFrameWnd::OnHelpIndex)
  35.     ON_COMMAND(ID_HELP_USING, COleIPFrameWnd::OnHelpUsing)
  36.     ON_COMMAND(ID_HELP, COleIPFrameWnd::OnHelp)
  37.     ON_COMMAND(ID_DEFAULT_HELP, COleIPFrameWnd::OnHelpIndex)
  38.     ON_COMMAND(ID_CONTEXT_HELP, COleIPFrameWnd::OnContextHelp)
  39. END_MESSAGE_MAP()
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // arrays of IDs used to initialize control bars
  43.  
  44. // toolbar buttons - IDs are command buttons
  45. static UINT BASED_CODE buttons[] =
  46. {
  47.     // same order as in the bitmap 'toolbar.bmp'
  48.     ID_EDIT_CUT,
  49.     ID_EDIT_COPY,
  50.     ID_EDIT_PASTE,
  51.         ID_SEPARATOR,
  52.     ID_APP_ABOUT,
  53.     ID_CONTEXT_HELP,
  54. };
  55.  
  56. /////////////////////////////////////////////////////////////////////////////
  57. // CInPlaceFrame construction/destruction
  58.  
  59. CInPlaceFrame::CInPlaceFrame()
  60. {
  61. }
  62.  
  63. CInPlaceFrame::~CInPlaceFrame()
  64. {
  65. }
  66.  
  67. int CInPlaceFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  68. {
  69.     if (COleIPFrameWnd::OnCreate(lpCreateStruct) == -1)
  70.         return -1;
  71.  
  72.     if (!m_wndResizeBar.Create(this))
  73.     {
  74.         TRACE0("Failed to create resize bar\n");
  75.         return -1;      // fail to create
  76.     }
  77.  
  78.     m_dropTarget.Register(this);
  79.     return 0;
  80. }
  81.  
  82. // OnCreateControlBars is called by the framework to create control
  83. //  bars on the container application's windows.
  84. BOOL CInPlaceFrame::OnCreateControlBars(CFrameWnd* pWndFrame,
  85.     CFrameWnd* /*pWndDoc*/)
  86. {
  87.     // create toolbar on client's frame window
  88.     if (!m_wndToolBar.Create(pWndFrame) ||
  89.         !m_wndToolBar.LoadBitmap(IDR_HIERSVRTYPE_SRVR_IP) ||
  90.         !m_wndToolBar.SetButtons(buttons,
  91.           sizeof(buttons)/sizeof(UINT)))
  92.     {
  93.         TRACE0("Failed to create toolbar\n");
  94.         return FALSE;
  95.     }
  96.  
  97.     // set owner to this window, so messages are delivered to correct app
  98.     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  99.     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_SIZE_DYNAMIC);
  100.     pWndFrame->EnableDocking(CBRS_ALIGN_ANY);
  101.     pWndFrame->DockControlBar(&m_wndToolBar);
  102.     m_wndToolBar.SetOwner(this);
  103.     return TRUE;
  104. }
  105.  
  106. /////////////////////////////////////////////////////////////////////////////
  107. // CInPlaceFrame diagnostics
  108.  
  109. #ifdef _DEBUG
  110. void CInPlaceFrame::AssertValid() const
  111. {
  112.     COleIPFrameWnd::AssertValid();
  113. }
  114.  
  115. void CInPlaceFrame::Dump(CDumpContext& dc) const
  116. {
  117.     COleIPFrameWnd::Dump(dc);
  118. }
  119. #endif //_DEBUG
  120.  
  121. /////////////////////////////////////////////////////////////////////////////
  122. // CInPlaceFrame commands
  123.  
  124. void CInPlaceFrame::OnUpdateContextHelp(CCmdUI* pCmdUI)
  125. {
  126.     pCmdUI->SetCheck(!!m_bHelpMode);
  127. }
  128.